<template>
  <div id="app">
    <div class="title_box">
      <div class="left_box">
        <p>AQI:  36   <span style="color: #00ffb4">优</span></p>
        <p>风力:  <span style="color: #ff9745">东风1级</span></p>
        <p class="weather">32° <span style="color: #ff9745">多云</span></p>
      </div>

      <h1>崂山党建大数据分析平台</h1>
      <div class="right_box">
        <p class="time">{{ time }}</p>
        <p>{{ date.date }}  {{ date.week }}</p>
      </div>
    </div>
    <div class="echart_box">
      <div class="item_box">
        <h2 class="h2_ttl">党员统计</h2>
        <div class="item_flex">
          <div class="item01">
            党员总数 <span>200人</span>
          </div>
          <m-echarts :data="data01" width="440px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">党龄</h2>
        <div class="item_flex">
          <div class="item02">
            所有人数 <span style="color: #ff9745">260<small>人</small></span>
          </div>
          <m-echarts :data="data02" width="360px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">党员状态</h2>
        <div class="item_flex">
          <m-echarts :data="data03" width="550px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">男女比例</h2>
        <div class="item_flex">
          <m-echarts :data="data04" width="200px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">党员类型</h2>
        <div class="item_flex">
          <m-echarts :data="data05" width="430px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">年龄</h2>
        <div class="item_flex">
          <div class="item02">
            所有人数 <span style="color: #34abff">260<small>人</small></span>
          </div>
          <m-echarts :data="data06" width="360px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">流动党员</h2>
        <div class="item_flex">
          <div class="item03">
            出国党员 <span style="color: #a859ff">20<small>人</small></span>
          </div>
          <div class="item03">
            国内党员 <span style="color: #ff9745">120<small>人</small></span>
          </div>
          <div class="item03">
            省内党员 <span style="color: #34abff">120<small>人</small></span>
          </div>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">处分类型</h2>
        <div class="item_flex">
          <m-echarts :data="data07" width="900px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">委员类型</h2>
        <div class="item_flex">
          <m-echarts :data="data08" width="900px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">学历</h2>
        <div class="item_flex">
          <m-echarts :data="data09" width="900px" height="200px"/>
        </div>
      </div>

      <div class="item_box">
        <h2 class="h2_ttl">职业</h2>
        <div class="item_flex">
          <m-echarts :data="data10" width="900px" height="200px"/>
        </div>
      </div>

    </div>

  </div>
</template>

<script>
import mEcharts from './components/mEcharts.vue'
import data01 from './assets/data01.js'
import data02 from './assets/data02.js'
import data03 from './assets/data03.js'
import data04 from './assets/data04.js'
import data05 from './assets/data05.js'
import data06 from './assets/data06.js'
import data07 from './assets/data07.js'
import data08 from './assets/data08.js'
import data09 from './assets/data09.js'
import data10 from './assets/data10.js'



export default {
  name: 'App',
  components: {
    mEcharts
  },
  data() {
    return {
      weather: '',
      date: {},
      timer: "",
      time: '',
      data01: data01,
      data02: data02,
      data03: data03,
      data04: data04,
      data05: data05,
      data06: data06,
      data07: data07,
      data08: data08,
      data09: data09,
      data10: data10,
    }
  },
  created() {
    this.data04.series.data = [
      {value: 124, name: '男'},
      {value: 247, name: '女'},
    ]

    this.date.week = this.getWeekDate()
    this.date.date = this.getDate()
    this.time = this.setTime()
  },
  methods: {
    getWeekDate() {
      let now = new Date();
      let day = now.getDay();
      let weeks = new Array("周日", "周一", "周二", "周三", "星期四", "周五", "周六");
      let week = weeks[day];
      return week;
    },
    getDate() {
      let d = new Date(),
          str = '';
      str += d.getFullYear() + '年'; //获取当前年份
      str += d.getMonth() + 1 + '月'; //获取当前月份（0——11）
      str += d.getDate() + '日';
      return str;
    },
    setTime() {
      let _this = this;
      this.timer = setInterval(function() {
        _this.time = _this.getTime();
      }, 1000);
      return _this.getTime()
    },
    getTime() {
      let d = new Date(),
          str = '';
      str += d.getHours() < 10 ? '0' + d.getHours() + ':' : d.getHours() + ':';
      str += d.getMinutes() < 10 ? '0' + d.getMinutes() + ':' : d.getMinutes() + ':';
      str += d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds();
      return str
    }
  }
}
</script>

<style>
#app {
  font-family: "Source Han Sans CN", Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-width: 1900px;

  /*height: 200vh;*/
  color: #fff;
  background-color: #000f40;
}
body,p,h1,div {
  margin: 0;
  box-sizing: border-box;
}
.title_box {
  display: flex;
  justify-content: space-between;
  margin-bottom: 44px;
  height: 110px;
  background: url("./assets/img/title_bg.png") no-repeat center top;
  background-size: cover;
}
.title_box h1 {
  margin: 0;
  font-size: 36px;
  letter-spacing: 4px;
  line-height: 68px;
  color: #fff;
  text-align: center;
}

.left_box {
  display: flex;
  padding: 5px 20px;
  width: 550px;
  font-size: 18px;
  font-weight: bold;
  line-height: 40px;
}

.left_box p {
  margin-right: 40px;
}

.left_box .weather {
  margin: 10px 0 0 40px;
  font-size: 35px;
}

.left_box .weather span {
  font-size: 18px;
}

.right_box {
  display: flex;
  justify-content: flex-end;
  padding: 5px 20px;
  width: 550px;
  font-size: 18px;
  font-weight: bold;
  line-height: 40px;
}

.right_box p {
  font-size: 18px;
  font-weight: bold;
}

.right_box .time {
  margin: 10px 170px 0 0;
  font-size: 35px;
}

.echart_box {
  display: flex;
  flex-wrap: wrap;
  padding: 0 30px;
  justify-content: space-between;
}

.item01 {
  margin-right: 30px;
  width: 195px;
  height: 98px;
  padding-top: 35px;
  font-size: 10px;
  line-height: 20px;
  color: #a6cdff;

  text-align: center;
  border-right: 1px solid #1b2a55;
  background: url("./assets/img/bg01.png") no-repeat center center;
}

.item01 span {
  display: block;
  font-size: 16px;
  line-height: 20px;
  color: #ffffff;
  font-weight: bold;
}

.item02 {
  width: 195px;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  border-right: 1px solid #1b2a55;
}

.item02 span {
  display: block;
  font-size: 36px;
  line-height: 48px;
  color: #ff9745;
  font-weight: bold;
}

.item02 small {
  font-size: 14px;
}

.item03 {
  width: 111px;
  margin: 30px 36px 0;
  padding-top: 45px;
  font-size: 12px;
  line-height: 20px;
  color: #a6cdff;
  text-align: center;
  background-repeat: no-repeat;
  background-position: center top;
  background-image: url("./assets/img/bg08.png");
}

.item03:nth-child(2) {
  background-image: url("./assets/img/bg06.png");
}

.item03:nth-child(3) {
  background-image: url("./assets/img/bg07.png");
}

.item03 span {
  display: block;
  margin-top: 50px;
  font-size: 22px;
  line-height: 48px;
  color: #ff9745;
  font-weight: bold;
}

.item03 small {
  font-size: 12px;
}

.item_flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.item_box {
  margin-bottom: 50px;
  padding: 6px 0 0;
  background-image: url("./assets/img/bg02.png"), url("./assets/img/bg03.png"),  url("./assets/img/bg04.png"),  url("./assets/img/bg05.png");
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-position: top right, top left, bottom right, bottom left;
  background-color: #011242;
}

.h2_ttl {
  margin: 0 0 -20px 20px;
  font-size: 18px;
  font-weight: normal;
  line-height: 48px;
}



</style>
